/*
 * id3_proc.h
 * This file is part of trypsyn-dsp
 *
 * Copyright (C) 2012 - Luke William Westby
 *
 * trypsyn-dsp is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * trypsyn-dsp is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with trypsyn-dsp. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef ID3_PROC_H
#define ID3_PROC_H

#include "trypsyn_dsp.h"
#include "id3_defs.h"

// utility functions
void trypsyn_id3_unsync(trypsyn_syncint32_t input, trypsyn_uint32_t *output);
void trypsyn_id3_swap32_ltb(trypsyn_syncint32_t input, trypsyn_uint32_t *output);
void trypsyn_id3_swap24_ltb(trypsyn_syncint32_t input, trypsyn_uint32_t *output);

// in the next # functions, neither arg can be NULL
int trypsyn_id3_read_header(trypsyn_id3_header *header, FILE *fp);
int trypsyn_id3_read_xheader(trypsyn_id3_xheader *xheader, FILE *fp);
int trypsyn_id3_read_frame_header_v2(trypsyn_id3_frame_header_v2 *frame_header, FILE *fp);
int trypsyn_id3_read_text_frame(trypsyn_id3_text_frame *text_frame, FILE *fp);

// in the next # functions, the arg cannot be null
int trypsyn_id3_print_header(trypsyn_id3_header *header);
int trypsyn_id3_print_xheader(trypsyn_id3_xheader *xheader);
int trypsyn_id3_print_frame_header_v2(trypsyn_id3_frame_header_v2 *frame_header, int index);
int trypsyn_id3_print_frame_header_v4(trypsyn_id3_frame_header_v4 *frame_header, int index);
int trypsyn_id3_print_text_frame(trypsyn_id3_text_frame *text_frame);

#endif
